<!doctype html>
<html lang="en">

<head>
	<title>Home</title>
	{%include file="public/head_common" /%}
</head>

<body>

	<!-- MAIN -->
	<div class="main">
		<!-- MAIN CONTENT -->
		<div class="main-content">
			<ul class="breadcrumb">
			    <li>账号管理</li>
			    <li>添加账号</li>
			</ul>
			<div class="container-fluid">
				<form class="form-horizontal" role="form" id="form1" method="post" action="{%:url('Account/handle')%}">
					
					<div class="form-group">
						<label for="firstname" class="col-sm-2 control-label">账号</label>
						<div class="col-sm-4">
							<input type="text" class="form-control" name="account" placeholder="账号">
						</div>
					</div>
					<div class="form-group">
						<label for="firstname" class="col-sm-2 control-label">密码</label>
						<div class="col-sm-4">
							<input type="password" class="form-control" name="password" placeholder="密码">
						</div>
					</div>
					<div class="form-group">
						<label for="firstname" class="col-sm-2 control-label">重复密码</label>
						<div class="col-sm-4">
							<input type="password" class="form-control" name="repassword" placeholder="重复密码">
						</div>
					</div>
					<div class="form-group">
						<label for="firstname" class="col-sm-2 control-label">姓名</label>
						<div class="col-sm-4">
							<input type="text" class="form-control" name="true_name" placeholder="姓名">
						</div>
					</div>
					<div class="form-group">
						<label for="firstname" class="col-sm-2 control-label">角色</label>
						<div class="col-sm-4">
							<select class="form-control" name="role_id">
								<option value=""> - 选择 - </option>
								<option value="1"> 销售</option>
								<option value="2"> 仓库</option>
								<option value="4"> 报单员</option>
								<option value="6"> 管理员(团队)</option>
								<option value="7"> 客服(团队)</option>
							</select>
						</div>
					</div>
					<div class="form-group">
						<div class="col-sm-offset-2 col-sm-10">
							<button type="button" class="btn btn-primary save">保存</button>
						</div>
					</div>
				</form>
			</div>
		</div>
		<!-- END MAIN CONTENT -->
	</div>
	<!-- END MAIN -->
	<div class="clearfix"></div>
	<!-- FOOTER -->
	{%include file="public/footer" /%}
	<!-- END FOOTER -->

	<!-- Javascript -->
	<script src="__STATIC__/assets/vendor/jquery/jquery.min.js"></script>
	<script src="__STATIC__/assets/vendor/bootstrap/js/bootstrap.min.js"></script>
	<script src="__STATIC__/assets/vendor/jquery-slimscroll/jquery.slimscroll.min.js"></script>
	<script src="__STATIC__/assets/vendor/jquery.easy-pie-chart/jquery.easypiechart.min.js"></script>
	<script src="__STATIC__/assets/vendor/chartist/js/chartist.min.js"></script>
	<script src="__STATIC__/assets/vendor/jquery.form.js"></script>
	<script src="__STATIC__/assets/vendor/layer-v3.1.1/layer/layer.js"></script>
	<!-- <script src="__STATIC__/assets/scripts/klorofil-common.js"></script> -->
	<script type="text/javascript">
		// $('#subPages').parent().siblings().();
		var options = {
	        //beforeSubmit:  showRequest,  // pre-submit callback   
	        success:       function(rsp){
	        	var opt = {
	        		type: 0,
	        		content: rsp.msg,
	        		closeBtn: 0,
	        		yes: function(index) {
	        			layer.close(index); //如果设定了yes回调，需进行手工关闭
	        			if (rsp.code>0) {
				  			location.href = "{%:url('Account/add')%}";
				  		}
	        		}
	        	};//layer的配置项
	        	if (rsp.code==0) {
	        		opt['icon'] = 2;
	        	} else {
	        		opt['icon'] = 1;
	        	}
	        	console.log(opt);
	        	layer.open(opt);
	        }, 
	        // other available options:   
	        //url:       "{:url('Goods/goodsHandle')}",        // override for form's 'action' attribute   
	        //type:      'post',        // 'get' or 'post', override for form's 'method' attribute   
	        dataType:  'json',        // 'xml', 'script', or 'json' (expected server response type)   
	        //resetForm: true,        // reset the form after successful submit   
    	};   
   		
	    $("#form1 .save").click(function () {
            $("#form1").ajaxSubmit(options);
            return false;
        });
	    
	</script>
	
</body>

</html>